<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <h2>接口及接口文档</h2>
    省<input type="text" name="sheng" value="安徽省">
    市<input type="text" name="city" value="安庆市">
    <button>测试</button>
    <ul class="list">
   
    </ul>
    <script src="./新闻列表/lib/axios.js"></script>
    <script>
     const btn=document.querySelector('button')
     const list=document.querySelector('.list')
     const province=document.querySelector('input[name="sheng"]')
     const city=document.querySelector('input[name="city"]')

     btn.addEventListener('click',function(){
      const pname=province.value
      const cname=city.value
        axios.get('http://ajax-api.itheima.net/api/area',{params:{pname,cname}}).then(({data:res})=>{
          const {data}=res
          list.innerHTML=data.map((item)=>{
            return ` <li>${item}</li>`
          }).join('')
        })
     })
    </script>
  </body>
</html>